Method and apparatus for event modeling

ABSTRACT

The present invention provides a method that allows a developer to add complex dependency logic to an existing database without having to modify the underlying structure of the database. One embodiment of the present invention provides a way to flexibly handle record state transitions by using an event model. The event model is a set of one or more items called an event. Each event in the event model has an associated event type and contains dependency logic that interrelates the events in the event model with one another. Each event represents a set of actions that are optionally contingent upon a condition. The actions and conditions that comprise an event are determine when the event is created. Each event may have a different set of actions and conditions. This enables an event to represent a number of different things. An event can represent anything it is defined to represent. In one embodiment of the present invention an event metamodel is instantiated to represent a number of different event models and the corresponding dependencies that interrelate them. The event metamodel enables the model creator to control what happens to each and every event in the event metamodel without having to modify the underlying structure of the database.

This is a continuation of application Ser. No. 09/170,026, filed Oct.12, 1998 now U.S. Pat. No. 6,341,279.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates to a method and apparatus for modeling events.

2. Background Art

A company that sells subscriptions to customers stores information aboutits customers in a database. The company would like to be able to reminda customer when the customer's subscription is about to end, and to givespecial offers to certain customers depending on who the customers areand how early or late the customers renew a subscription. Currentdatabase systems do not operate efficiently when the database becomeslarge. Current databases also lack the flexibility to be changed toallow the addition of new types of data to a customer database entry.Problems with existing database systems can be understood by firstreviewing database systems.

When data is collected and stored on a computer in an organized mannerthat collection of data is called a database. In an effort to make thedata stored in databases easily retrievable, databases are organizedaccording to a predetermined structure. Unfortunately, once theunderlying structure of the database is implemented the process ofchanging it is cumbersome. To add new relationships to a database thestructure of the entire database must often be redefined. As a result,current database models inherently lack flexibility.

Database Organization

Databases are organized according to a data model that specifies theorganizational structure of the database. A variety of different datamodels exist and each organizes data in a different manner. Examples ofdata models include the relational model, the object oriented model andthe physical data model.

Once a data model is chosen the overall design of the database isimplemented using that model. This overall design of the database isoften referred to as the database schema and is defined by using aspecial language called a data definition language (DDL).

A database may contain one or more tables that are defined in a filecalled the data dictionary. Tables help keep the data in the databaseorganized. FIG. 1 illustrates a table 100 that contains informationabout customers. Each table is designed to store a collection of dataand is comprised of a number of rows 101-107. A row is separated intoone or more columns 120-124 and each column is designated to receivevalues that have an associated name 140. When data is placed into thetable 100 it is placed in the appropriate column 120-124. For example,values 130-135 represent a series of customer identification numbers.These values are placed in column 120. Once an entry in a columncontains an item of data it is referred to as a record. Each table mayhold numerous records. When a row 101-107 is filled with data itrepresents a unique set of records. For example, if data were placed incolumns 120-124 of row 101 that data is representative of the customerthat has the customer identification number 130.

A disadvantage of the way database tables are organized is that itsorganizational schema is predetermined and fixed. As a result currentdatabases lack a flexible structure. For example, if a person usingtable 100 wanted to begin collecting other kinds of addressinginformation about a customer, such as the customers work address orelectronic mail address, a new column 206 to hold that information isrequired and must be defined. To define a new column a new table 200that has an additional column 206 is created. Thus an inherentdisadvantage of current database systems is that the user is locked intocollecting the kind of information the table is pre-defined to hold.Table 100, for example, can only hold information pertaining to acustomer's identification number, a customer's name, a customer'saddress, a customer's phone number, and a customer's fax number. Toenter any other kind of information in Table 100 a new column must bedefined.

Another disadvantage of current database systems is that every field ina table is assigned a value even if one does not exist. Referring now toTable 200 in FIG. 1, if data is entered into one of the columns in row102 data must also entered into all the remaining columns. When no realinformation exists to input into a column, some other value, such as aNULL value, zero, or some other value. For example, if the value “Bob”is placed in the column 121 of row 102 and the value “14 Main St” isplaced in column 122 of row 102 the remaining columns in row 102 areassigned NULL values. Since values are assigned to every row in column120, the remaining values of each row are filled with NULL values. Thisoccurs regardless of whether additional information is actually enteredinto Table 200. Once a row is filled with one piece of data theremaining entries for that row are filled with some value. Placingvalues inside a table even when one is not supplied wastes memory andcomputing resources.

Data that is stored in the records of a table can form the basis of arelationship between another table in the database as long as the othertable has a related record. Data stored in a column (or columns) of atable can form the basis for a relationship between that table andanother table in the database having a related column (or columns). Forexample, the customer table could be related to a table the customerorders table if the customer table contains a series of records havingfields with the names “customer identification”, “last name”, “firstname”, “street address”, “city”, “zip code” and the customer orderstable has fields with the names “customer identification”, “serviceprovided”, and “date service rendered.” Since both of these tables sharea field with the name “customer identification”, the tables are bothrelated to the same customer. Using a relationship between columns oftwo tables, it is possible to join these two tables to provide a singletable of information that contains instances of rows from one tablecombined with related rows from the other table.

Tables may be related via one-to-one, one-to-many, or many-to-onerelationships. In a one-to-one relationship, one row in one table isrelated to a single row in a second table and vice versa. For example, arow in an employee table that contains information about an employeerelates to a salaries table that contains the employee's salaryinformation. Since an employee is typically only earning a singlesalary, there is a one-to-one relationship between an employee'semployee table record and the employee's salary table record.

In a one-to-many relationship, a row in one table may be related to manyrows in a second table, but each row in the second table matches onlyone row in the first table. For example, a state table that contains astate identifier and a state name can be related to multiple rows in theemployee table. However, a row in the employees table identifies onlyone state of residence, for example. Conversely, a many-to-onerelationship exists where many rows in one table match only one row in asecond table, but each row in the second table may match many rows inthe first table.

To relate two tables, it is necessary to identify one or more columnsthat are common to both tables. These columns are typically referred toas keys. A primary key is a unique key within a table and uniquelyidentifies a row within the table. A foreign key in a second table iscomprised of the column(s) containing a first table's primary keyinformation. For example, in the employee table, an employee identifier(employeeID) can be assigned to uniquely identify each employee. TheemployeeID can be used as a primary key for the employees table. TheemployeeID can also be used as a foreign key in the salaries table. Theemployees and salaries tables can be joined by the employeeID columns ineach table to have information from both tables available in a singlerecord.

Applications are developed to provide a user with the ability tofacilitate access and manipulation of the data contained in a DBMS. ADBMS includes a Data Manipulation Language (DML) such as StructuredQuery Language (SQL). A DML provides set-oriented relational operationsfor manipulating data in the DBMS. However, a DML requires a precisesyntax that must be used to access and manipulate DBMS data. To use aDML, a user must understand and use the DML's syntax. Instead ofrequiring each user that wishes to modify a DBMS' data to learn theDML's syntax, applications are written that provide an interface betweenthe user and a DBMS' DML.

A database application typically includes a graphical user interface(GUI) that is comprised of presentation elements such as a form. A formis a self-contained presentation element with predefined areas fordisplaying, entering and/or changing data. The predefined areas aretypically referred to as fields.

Fields in a form can be read-only (e.g., a label field). A form can alsohave fields in which information is displayed and the user can enterinformation. For example, in an operation to modify an employee's lastname, a text field can be used to display the name currently stored inthe database and allow the user to overwrite the display to enter theemployee's new last name. When user submits the information, theapplication can retrieve the user input and update the databaseaccordingly.

To populate the fields in a form, the application developer mustassociate fields in the database with fields in the form. This processis typically referred to as binding database fields with form fields. Ina simple example of a form, the fields contained within the form arebound to fields in a single table.

A form can be more complicated where fields receive data from multipletables. The application developer designing a form must be aware of therelationship(s) that exist between the tables that are to be bound tothe fields in the form. If, for example, the form contains fields fromtables that are related via a one-to-many relationship, the applicationdeveloper must design the form the accommodate multiple rows ofinformation. For example, a form that displays a department and its joblistings (which are related via a one-to-many relationship) must be ableto display the department information as well as multiple job listingsfor that department. The form must be designed to display the departmentand include multiple rows to display the job listings for thedepartment, for example.

The relationship between the department and job listings tables is aone-to-many relationship. That is, there can be many job listings for agiven department. The format of the display of information related by aone-to-many relationship is different than that used to displayinformation related by either a many-to-one or one-to-one relationship.

For example, the employees, salaries and state tables are related toeach other via many-to-one (e.g., more than one employee can reside inthe same state) and one-to-one relationship (e.g., each employee has asalary). Since a row in the employees table is related to a single rowin state and salaries tables, the developer can design a form withfields that display information about an employee taken from these threetables. For example, the form can contain fields to display theemployee's name, state of residence and salary.

Thus, it can be seen that the design of a form depends on the type ofrelationships that exist between the tables. Using existing interfacedesign tools, the application developer has been required to haveknowledge of these relationships. The application developer must beaware of the structure of a database including the tables, the columnswithin a table and the relationships between tables. For example, anapplication developer that is building a form to display outputretrieved from a database must associate fields in the form with columnsin the database. If the form includes columns from multiple tables, thedeveloper must be aware of the relationships that exist between thetables which includes the type of relationship.

Data Collection

One way to collect information and place it into a database is by usingthe Internet. The Internet is a worldwide network of interconnectedcomputers. A user accesses the Internet by using an Internet client. AnInternet client is a piece of computer software that communicates withthe Internet via an Internet provider. An Internet provider is anorganization that provides a client (e.g., an individual or otherorganization) with access to the Internet (via analog telephone line orIntegrated Services Digital Network line, for example).

The World Wide Web (WWW) is a portion of the Internet that transfersinformation using HyperText Transfer Protocol (HTTP). HyperText TransferProtocol (HTTP) is one of the standard protocols a client uses tocommunicate with a server on the WWW. Other protocols such as TCP/IP andFTP are also used. A server is the computer where information is storedbefore it is sent to the Internet client. Servers may store any kind ofdata. For example a server may store a database or a series of webpages. A web pages is a document that, for example, is programmed usingHyperText Markup Language (HTML). HTML is one of the languages Internetclients understand.

A user can send information to the server by using an Internet client.The server can collect this information and add it to a database. Thiscreates a database of user information. The database of user informationis a collection of data about users. The information contained in theuser database is typically information provided by the user, but it canalso be obtained from other sources.

In one embodiment of the invention the user provides information to theserver by completing an online form. For example, the user might want toreceive a free subscription to an electronic newsletter. To receive theelectronic newsletter the user provides the publisher of the newsletterwith an electronic mail address, a street address, and credit cardinformation. One way of providing this information is by using a webpage that contains an online form. An online form is programmed in HTMLby using the FORM element. HTML includes a FORM element that providesthe ability to create a web page that has a fill-in form.

An HTML document containing a FORM element permits the user to enterinformation and send that information to the client. The user enters theinformation through the use of a limited number of FORM components:checkboxes; radio boxes; pull-down lists; text windows; and menus. Theinformation entered through the FORM components is transmitted as asingle unit to a gateway program on the server. In this manner the usercan send information to the server. For example, the user can send theinformation necessary to subscribe to the electronic newsletter. Oncethe server receives the information provided by the user the serverstores it in a database.

In one embodiment of the invention information is obtained from the userby collecting information provided by the HTTP protocol. When a uservisits a web site HTTP passes information between the server and theinternet client using environment variables. In this embodiment theinformation contained in these environment variables is collected andthen stored on the server for later use. For example, the environmentvariables USER_NAME, DATE_GMT, and DOCUMENT_NAME all contain usefulinformation about the user. The variable USER_NAME contains the name ofthe user as it is defined in the users internet client. The variableDATE_GMT specifies the date the user visits a web page and the variableDOCUMENT_NAME provide the name of the document a user is viewing. Thisinformation provided by the HTTP protocol is stored in a database andsupplemented with information obtained from other sources.

SUMMARY OF THE INVENTION

The present invention provides a method that allows a developer to addcomplex dependency logic to an existing database without having tomodify the underlying structure of the database.

The status of records in a database change over time. The status of arecord is referred to as the “state” of the record. When the recordsstatus changes it is called a state transition. One embodiment of thepresent invention provides a way to flexibly handle state transitions byusing an event model. The event model is a set of one or more itemscalled an event. Each event in the event model has an associated eventtype and contains dependency logic that interrelates the events in theevent model with one another.

An event provides a way to manipulate data that is not dependent uponthe structure of the data it is manipulating. Each event represents aset of actions that are optionally contingent upon a condition. Theactions and conditions that comprise an event are determine when theevent is created. Each event may have a different set of actions andconditions. This enables an event to represent a number of differentthings. An event can represent anything it is defined to represent.

In one embodiment of the present invention an event metamodel iscreated. An event metamodel is a model of one or more event models.Thus, it is a model of a model. An event metamodel can be instantiatedto represent a number of different event models and the correspondingdependencies that interrelate them. The event metamodel is used, forexample, to describe a set of modeled events. This is accomplished bymaintaining values that represent the type of events the event metamodeldescribes.

The event metamodel enables the model creator to control what happens toeach and every event in the event metamodel without having to modify theunderlying structure of the database. Instead of changing the structureof the database a new data type can be created in the event model. Oncethis new data type is created it can immediately be used. Thus, theevent metamodel provides a way to add functionality to a database andimmediately make that functionality available for use. All of this isdone without having to create new tables or change the relationship thatexists between tables.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a database table that contains customer information.

FIG. 2 illustrates an example of a computer system used to implement thepresent invention.

FIG. 3 illustrates how a set of events are grouped together in oneembodiment of the invention.

FIG. 4 illustrates how certain values are interrelated.

FIG. 5 illustrates how one embodiment of the invention handles statetransitions.

FIG. 6 illustrates how an event metamodel is organized in one embodimentof the invention.

FIG. 7 illustrates a framework for organizing data associated with theevent metamodel.

FIG. 8 illustrates how one embodiment of the invention categorizes thedata contained in a database.

DETAILED DESCRIPTION OF THE INVENTION

A method and apparatus for event modeling is described. In the followingdescription, numerous specific details are set forth in order to providea more thorough description of the present invention. It will beapparent, however, to one skilled in the art, that the present inventionmay be practiced without these specific details. In other instances,well-known features have not been described in detail so as not toobscure the invention.

The claimed invention can be used to manipulate or add to the datacontained in a database. The invention is used, for example, onrelational databases, object-oriented databases, or other databaseenvironments. One embodiment of the invention is useful when an existingdatabase needs new capabilities. The claimed invention allows thedeveloper to add complex dependency logic to an existing databasewithout having to modify the underlying structure of the database. Thisfrees the developer from having to add columns or change therelationships established in the existing database. Instead thedeveloper can utilize the present invention to define a new event. Whatan event comprises is discussed below. A new database can also becreated to take advantage of the benefits provided by the presentinvention. The present invention provides a level of generality thatmakes it possible to flexibly expand a database environment.

State Transitions

The present invention can be used in a subscription service environment.A database is used to store records corresponding to customers thatsubscribe to some provide product or service. During the life of thesubscription the status of a customer changes. Examples of the differentstatus a customer may have over time may include status as a newcustomer, a customer who's subscription is about to expire, a customerwho is targeted for a specific renewal offer, a newly renewed customerthat has not yet paid the subscription fee, and others. Groups ofcustomers may acquire a status based on the date that renewal or serviceis requested. A customer may also be part of a group that subscribedunder a specific promotion or offer. The status of a customer orcustomer record is referred to as its “state” in the invention and mayundergo one or more state transitions over time.

Record State

Over time the status of a record in the database changes. A record thatwas once the newest record is no longer the newest record when anotherrecord is entered. The status of a record is referred to as the recordsstate. When a records status changes it is called a state transition. Astate transition is a change in how two or more pieces of datainterrelate. An action, such as removing a person from the subscriberlist, can cause a state transition to occur. When a person cancels asubscription to a magazine, for example, that person is no longer acurrent subscriber of the magazine. Thus, the person's state transitionsfrom that of a current subscriber to a previous subscriber.

In one embodiment of the invention the data contained in a database iscategorized according to its status. Referring now to FIG. 8 forexample, a database of users 800 can be categorized according to theusers 801-806 current status. If, for example, user 801, 803, and 805sign up to receive a free 6 month subscription to an online newsletterthese users belong to the free trial subscriptions category 820. Ifafter 6 months passes users 803 and 805 choose to continue receiving thenewsletter and begin paying for it, users 803 and 805 are placed in thepaying subscribers category 830. If user 805 then decides to cancel thesubscription, then user 805 is placed in the canceled subscriptionscategory 840. After 6 months pass the users that have not renewed theirsubscription are also placed in the canceled subscriptions category 840.

Each category may have subcategories. The paid subscriptions category820, for example, could contain a subcategory 821 called “discountsubscribers” and another subcategory 822 called “preferred subscribers.”

Over time the status of the data that resides in one categorytransitions to another category. When data changes categories it iscalled a state transition 850. Data is assigned to a different categorywhen the criteria that places it in a category changes. For example, thedata held in the free trial subscribers category 820 is moved to thecanceled subscriptions category 840 when a person lets theirsubscription run out or cancels it. When this happens another statetransition 850 occurs.

Categorizing the database according to the status of the data held in itallows separate actions to be performed on each category. Placing usersinto separate categories, for example, allows separate actions to beperformed for each group of users. A database administrator coulddecide, for example, to send an electronic mail message to the users whoare in the paying subscribers category to thank them for subscribing orto offer additional services. Categorization allows actions to bedirected specifically at a certain group of users based on criteriaspecified by the database administrator, for example.

Event MetaModel

In the invention, events in an event metamodel M are represented asnodes of a directed graph G. Each node, or event, has associated with itthe following attributes:

An internal state,

Zero or more pieces of data specific to this particular event,

Zero or more pieces of data shared by all events of the event type asthis, event,

A way to decide when to try to generate a new internal state, and

A way to generate a new internal state.

The event metamodel provides a framework in which multiple event modelscan be instantiated, and it contains a built-in clock mechanism whichwill drive an instantiated event model, turning it into an eventprocessor.

A number of terms are used in describing the metamodel of the presentinvention.

An abstract serializable typed data object whose string representationis no longer than the length of the datatype longest_varchar is called adatum. A datum can be associated with event instances and with abstracttype objects.

An abstract type, also called, relative to itself, a super-0-type orjust type, is a label supplied by the model developer which supplies theexternal semantics for elements of M. A type is itself a typed object.The type of an abstract type is called a supertype, or super-1-type.Thus the set of all abstract types contains abstract types, super-types,super-super-types (written super-2-types), and so on, and can be writtenU_(kε{0}∪κ) _(^(super-k-type)) .

A datum shared by more than one event or type is called a type datum andis associated with an abstract type. A type datum is inherited unlessoverridden by subtypes, just as public data members are inherited inJava or C++. For example, let E be a set of distinct events which sendemail. Suppose that events E1={e1, e2, . . . , e}⊂E use mailserver m1and the remaining events E2=E\E1 Ø use mailserver m2 m1. And supposethere are other datums, such as where to log the fact that mail wassent, which are common to all events in E. To compactly represent E onecan create a type T1 and a subtype T2 of T1, and then store the datumsshared by all events as type datums of T1. Then for iε{1, 2}, one canstore mi as a type datum of Ti and associate each member of Ei withevent type Ti. This will cause T2 to override the mailserver name of T1with m2 while preserving access by members of E2 to other shared datumsof T1.

A datum specific to a single event instance and not shared with anotherevent or type is called an event datum. For example: suppose it isdesired to email a form letter to user number 144332 at 10:00 PMtomorrow night. The following datums could be associated with an eventwhich would actually send the email: userid 144332, fantasy team name,tomorrow's date, and the name of an email template letter.

An event dependency relationship exists between an event e2, called adependent event, and an event e1, called a prerequisite event, if andonly if there exists an edge of G which starts at e1 and ends at e2. Inthis case, event e1 is said to precede event e2, and event e2 is said todepend upon event e1.

The semantics of the word “depend” here are supplied by the triggerfunction associated with the abstract type of ej. The event dependencyrelationship forms a mesh on M. That is, an event can depend upon zeroto many past events, and an event can be a past event of zero to manyevents.

An hierarchical type containment relationship, or htcr, associates a oneor more abstract types with a exactly one metatype. The htcr representsthe set of relationships between super-k-types and super-(k+1)-types forkε{0}∪N There can be more than one meaningful way to order a given setof abstract types in a type containment hierarchy. For this reason a newabstract type called CONTAINMENT TYPE is created and a typediscriminator called containment type is associated with the orderingrelation. The semantics of an htcr are provided by its containment type.

Consider, for example, an inventory application that tracks variousitems for manufacturing. One useful htcr, say of containment type a,might be Ha defined as

bolts, fabric, fuel, otherthings parts   airplane Bob, Sue, other peoplelabor

Another useful htcr, say of containment type b a, might be Hb defined as

Bob, Sue, rubber, fabric nonhazardous materials airplane fuel, cleaningchemicals hazardous materials

This implementation of type containment represents a compromise betweenthe ease-of-use of a tree structure and the flexibility of a mesh.

An event instance, or event, is a set of actions, possibly empty, whichis optionally contingent upon a condition. An event is associated withone abstract type te called the event type.

An event can depend upon zero or more events, and zero or more eventscan depend on it. And an event can optionally have a trigger functiont_(e), a state function t_(e), or both.

The name of the stored procedure which implements t_(e) for te is givenby the TRIGGER FUNCTION datum associated with te. The name of the storedprocedure which implements t_(e), for te is given by the STATE FUNCTIONdatum associated with te. The model semantics of “depends” and “state”are given by t_(e) and t_(e) respectively.

t_(e) takes as input the set of events upon which an event e depends andtheir respective states, and returns a value of one or zero indicatingwhether the event e has been “triggered” or “not triggered”respectively. It expresses a model's policy of when to continueprocessing events dependent upon the state of event and when not to. Thecase where t_(e) is null is equivalent to te having no trigger functionat all.

The state t_(e) will be computed only if an event is triggered. t_(e)returns an event_state se, based on the outcome of the ordered set ofactions t_(e) tries to perform. The case where t_(e) is null isequivalent to t, having no state function at all.

The set S of possible event states is defined by the model developer andwill vary according to the event sets being modeled. Consider, forexample, if modeling set of events relating to a credit cardauthorization, then a useful set of states for these events mightinclude the following states: “Authorization approved”, “Authorizationdeclined”, “Hardware error—cannot retry”, “Line is busy—retry later”.

Let

N be the set of natural numbers,

|X| denote the number of elements in a finite set X,

E={e1, e2,, ei,, e_(|E|)} be the set of modeled events,

S={s1, s2,, si,, s_(|S|)} be the set of all possible event states,

T={t1, t2,, ti,, t_(|T|)} be the set of all abstract types,

D={d1, d2,, di,, d_(|D|)} be the set of all datums,

EDi=(ed1, ed2,, edj,, ed_(|ED) _(i) _(|))⊂D be the ordered set of allelements of event-specific data associated with event i,

TDi=(td1, td2,, tdj,, td_(|TD) _(i) _(|))⊂D be the ordered set of allelements of type-specific data associated with abstract type I,

Γ(x, c) denote the supertype operator relative to containment type c,which for an abstract type t returns the unique supertype of x in thetype hierarchy selected by c if such a supertype exists, and the emptyset otherwise,

Γ(x, c) denote the nth repeated application of to x, relative to c,

Δ(x) denote the dependency operator, which for an event x returns theset of events upon which x depends.

Subsets of G

The set of active events is the set of events whose state se is of atype which derives from either the abstract type Y et=YET To HAPPEN orthe abstract type Happening=HAPPENING. The set Active can be written asActive={e εE:∃n εN,∃t, εTsuch.thatΓ^(n)(t_(e),State)ε{Yet, Happening}}where State is equal to the containment type STATE and te is the type ofevent e.

An event which is not active is called inactive. The set of inactiveevents is just the set complement of Active relative to E, that isInactive=E\Active.

An event upon which no event depends is called a leaf event. The set ofleaf events can be written as Leaf={eεE:e∉U_(iεE) _(^(Δ(i))) }.

An active leaf event is said to be a computable event. The set ofcomputable events can be written Computable=Active∩ Leaf.

Propagation of Event Logic

During each tick of the internal clock, all computable events areprocessed in random order. The following steps occur once per clockcycle, or tick, for each computable event e of event type te:$\begin{matrix}{{1.\quad {Define}\quad z} = \quad {\tau_{t_{e}}\left( {\Delta \quad (e)} \right)}} & {\quad {{if}\quad \tau_{t_{e}}\quad {exists}}} \\{\quad 0} & {\quad {otherwise}}\end{matrix}$

2. If z=0 and φ_(t) _(e) exists, then let se=φ_(t) _(e) (e).

Thus complex application logic propagates in G at the rate of at mostone complex operation, or node traversal, per tick. Multiple logic pathsexecute in parallel.

Example Embodiment

FIG. 5 illustrates how one embodiment of the invention handles statetransitions. This embodiment of the present invention provides a singlemetaphor for representing state transitions. This is accomplished byusing an event model 500. The event model 500 is a set of events501-506. Each event 501-506 in the event model 500 has an associatedevent type 511 and contains dependency logic that interrelates theevents in the event model. An event in the event model can represent anykind of action it is defined to represent.

Each event model 500 contains one or more events 501-506. An eventprovides a way to manipulate data that is not dependent upon thestructure of the data it is manipulating. Once an event is instantiatedit is referred to as an event or an event instance. Each event 501-506represents a set of actions that are optionally contingent upon acondition. The actions and conditions that comprise an event aredetermine when the event is created. Event 503, for example, has acondition 532 that causes an action 533 to occur. Each event may have adifferent set of actions and conditions. This enables an event torepresent a number of different things. For example, an event can becreated that represents the users in a database. An event could alsorepresent the number of people who chose to visit a certain web page. Anevent can represent anything it is defined to represent. An event candepend on past events. In one embodiment of the invention when an eventis created it is called an event instance. In one embodiment of theinvention an event model M_(c) is defined by defining an event, an eventtype, a dependency operator, and an event state. In this embodimentevent model M_(c) represents a model for cellular automaton. An event isdefined as follows: let m,nεN, and let E be a set of m*n events. This iswritten as

E={e₁₁,e₁₂, . . . ,e_(ln),e₂₁, . . . ,e_(2n), . . . ,e_(ml), . . .,e_(mn)}

Event E, for example, could represent a set of cells. Each event in theevent model is associated with an abstract type called the event type511. An event type 511 is a label supplied by the event model developerthat supplies the external semantics for elements of an event metamodel.For example, in one embodiment of the invention all event types defineall the event of E to be of the same event type. That is, for all xεE,define t_(x)=c, where c is a constant event type. An event type 511, forexample, represents an abstract object type. An abstract object type isitself a typed object. Thus, the set of abstract object typesrepresented by this entity includes meta-types, meta-meta-types,meta-meta-meta-types, and meta-k-types where k is some natural number.In one embodiment of the invention an event type 511 is created torepresent more than one event in the event model 511. If an event modelcreates three events that carry out similar tasks, one event type 511can represent all three event. For example, if three events are createdto send out electronic mail on different days these events can share thesame event type 511. In FIG. 5 events 501-506 all share the same eventtype 511. In one embodiment of the present invention the data that isassociated with an event type is called type datum.

In one embodiment of the present invention events can process data thatis held in a database. For example, if a database containing userinformation is processed by an event called “subscription expired.” The“subscription expired” event may have actions and conditions that definehow it behaves. If the condition is satisfied the action is taken. Forexample, if the “subscription expired” event is processing the userdatabase and it discovers a user whose subscription is expired the eventwill send that user a newsletter.

In one embodiment of the invention each event in an event model maydepend on one or more other events. When this occurs an event dependencyrelationship 521 is created. An event dependency relationship isrepresented by the dependency operator. In one embodiment of theinvention a bounding function b(x,u) is defined as:${b\left( {x,u} \right)} = \begin{Bmatrix}1 & {{{if}\quad x} < 1} \\u & {{{if}\quad x} < u} \\x & {otherwise}\end{Bmatrix}$

The dependency operator Δ is the defined as:${\Delta \quad \left( e_{ij} \right)} = {\bigcup\limits_{k,{l \in {\{{{- 1},1}\}}}}\left\{ e_{{b{({{i + k},m})}},{b{({{j + l},n})}}} \right\}}$

The function says that if E is written as an m*n array, then each evente_(ij) depends upon all of its neighboring elements in the array. Theabove set of functions can be used to create a dependency relationshipfor an event model that emulates a simple cellular automaton.

An event dependency relationship 521 exists between an event called thedependent event and event called the prerequisite event. An eventdependency relationship, for example, could be created to represent thefact that a subscription cannot expire unless a subscription firstexists. To accomplish this a dependent and prerequisite event arecreated. Referring now to FIG. 5 for example, event 501 is aprerequisite event called “current subscribers” and event 502 is adependent event called “subscription expired.” In this example event 502cannot occur unless event 501 first occurs. Therefore, events 501 and502 are representative of the fact that a subscription cannot expireunless a person is first a subscriber.

Event Nodes

In one embodiment of the invention each event is represented as anindividual node. FIG. 3 illustrates how a set of events are groupedtogether. One way of representing one or more events is as nodes 301-308in a directed graph 300. A directed graph 300, sometimes called adigraph, is a non-linear data structure. In a directed graph 300 eachnode 301-308 can have any number of links to any other node 301-308. Forexample, node 303 is linked to node 302, and node 307. This enables oneevent to depend on other events. The event nodes 301-308 contain a listof attributes 310-314 n. The number of attributes 310-314 n isdetermined by the person creating the event. There are a variety ofdifferent things an attribute can represent, for example, an attributecould represent an internal event state 310, data specific to aparticular event 311, data shared by all events having the same eventtype 312, a way to decide when to try to generate a new internal state313, and a way to generate a new internal state 314. More than oneattribute can be created and an attributes can represent anything theprogrammer defines it to represent.

The events 301-308 illustrated in FIG. 3 each have an event state 310.An event state 310 is defined by the developer and varies according tothe event that is created. For example, if a set of events relating tocredit card authorization system is modeled, then the developer mightchoose to create the following event states: “authorization approved”,“authorization declined”, “hardware error—cannot retry”, “line isbusy—retry later.” In one embodiment of the invention a set of possibleevent states S is defined as S={0,1}. The number of events neighboring ewhich are in state 1 is defined as W(x)=|{eεΔ(x):S_(e)=1}|. The statefunction is then defined as: $\phi = \begin{Bmatrix}1 & {{{if}\quad {W(e)}} > 2} \\0 & {otherwise}\end{Bmatrix}$

The function φ says that an event is in state 1 if three or more of itsneighboring events are in state1. When an event is in state 1 it isconsidered to be “alive”. If an event is in state 0 it is considered tobe “dead.” Thus, function φ corresponds to the cell transition rules forJohn H. Conway's game of LIFE. Defining event states in this manner incombination with the dependency operator allows the developer torepresent an event model M_(c).

In one embodiment of the present invention each event also contains dataor datum associated with it. The data or datum associated with an eventis called event datum. Event datum is data that is specific to a singleevent instance. For example, if an event is created to send anelectronic mail message to the winner of an online game the followingdata is associated with the event: a user identification number, theuser's electronic mail address, the date the message is sent, and thetext that comprises the message. Typically an event datum is not sharedwith another event, although in some instances it may be.

A type datum, on the other hand, is shared by more than one event. Atype datum is associated with an abstract type and provides a way tocompactly represent a set of events. This is accomplished by storing allthe data shared by more than one event as type datums.

In one embodiment of the present invention an event can optionally haveboth a trigger function and a state function. A trigger functionindicates whether an event has occurred or not. It does this by takingas input the set of events and their respective states upon which theevent having the trigger function depends. If an event is “triggered”the trigger function returns a value of one. If the event is “nottriggered” a value of zero is returned. The trigger function expressesthe event model's dependency logic. That is it expresses the model'spolicy of when to continue processing events and when not to. Thetrigger function does this by implementing a stored procedure when theevent is triggered. An event does not need to have a trigger function. Astate function is utilized when an event is “triggered”. An event'sstate function returns the event state. An event is not required to havea state function either.

Event Metamodel

In one embodiment of the present invention an event metamodel iscreated. An event metamodel is a model of one or more event models.Thus, it is a model of a model. An event metamodel can be instantiatedto represent a number of different event models and the correspondingdependencies that interrelate them. The event metamodel is used, forexample, to describe a set of modeled events. This is accomplished bymaintaining values that represent the type of events the event metamodeldescribes. The event metamodel enables the model creator to control whathappens to each and every event in the event metamodel without having tomodify the underlying structure of the database. Instead of changing thestructure of the database a new data type can be created in the eventmodel. Once this new data type is created it can immediately be used.Thus, the event metamodel provides a way to add functionality to adatabase and immediately make that functionality available for use. Allof this is done without having to create new tables or change therelationship that exists between tables.

FIG. 6 illustrates how an event metamodel 600 describes a set of modeledevents 601-605. The event metamodel 600 provides a framework in whichmultiple event models 601-605 can be instantiated, and it contains abuilt-in clock mechanism that drives an instantiated event model601-605, thus turning it into an event processor. More than onemetamodel 600 can be created. Each event metamodel 600 contains a listof entities 610 that represent various attributes of the event metamodel600.

In one embodiment of the invention the list of entities 610 contains thevalues event_instance 611, ev_type 612, ev_datum 613, event_datum 614,ev_type_datum 615, ev_type_containment 616, event_dependency 617, andevent_state 618. Each value describes a different feature of the eventsthe event metamodel represents. All the values that begin withev_comprise the event metamodel, although other values may be added orsubtracted at any time.

The event_instance 611 value represents the entire set of modeledevents. The ev_type 612 value represents a set of all the abstract typeseach event contains. An abstract type is a label supplied by the modeldeveloper that supplies the external semantics for elements of the eventmetamodel. Each abstract type also has a type called the supertype, orsuper-1-type. Thus, the set of all abstract types contains abstracttypes, super-types, and super-super-types. The ev_datum 613 valuerepresents a set of all the data each event is associated with. Theevent_datum 614 value represents an ordered set of all elements ofevent-specific data associated with an particular event. Theev_type_datum 615 value represents an ordered set of all the elements oftype-specific data associated with an abstract type. Theev_type_containment 616 value represents a type containmentrelationship. The details of a type containment relationship arediscussed below. The event_dependency 617 value represents the eventdependency relationship of each event defines. For example, theevent_dependency 617 value describes the set of events that anotherevent depends on.

The event_state 618 value represents a set of all the possible eventstates each event within the event metamodel 600 has. The eventmetamodel may contain additional entities other than the onesillustrated in FIG. 6. For example, entities may be added that improvethe performance and maintainability of the event metamodel 600.

In one embodiment of the invention the values 611-618 that comprise thelist of entities 610 is stored in a database. How each value 611-618 isinterrelated is illustrated in FIG. 4. The values event_instance 611,ev_type 612, ev_datum 613, event_datum 614, ev_type_datum 615,ev_type_containment 616, event_dependency 617, and event_state 618 areshown.

The ev_type 612 describes one or more ev_datums 613. Thus, an ev_type612 is the parent entity for ev_datum 613. An ev_type 612 comprises anev_type_id 904 and a description 905. The ev_type 612 represents anabstract object type. An abstract object type is itself a typed object.Thus, the set of abstract object types represented by this entityincludes meta-types, meta-meta-types, meta-meta-meta-types, andmeta-k-types where k is some natural number. The ev_type_id 904 is usedto uniquely identify each abstract type. In one embodiment of theinvention the ev_type_id 904 functions as a primary key for the ev_type612. The description 905 contains a name or description which uniquelyidentifies the ev_type. The event model internal code uses thisattribute to uniquely identify object types. Description 905 is alsomade available to external applications for the same use.

In one embodiment of the invention ev_datum 613 is described by anev_type 612. An ev_datum 613 stores one or more ev_type_datum(s) 615. Anev_datum 613 comprises an ev_datum_id 900, datum 901, and an ev_typeid/datum_type_id 902. The ev_datum value 613 represents an abstractserializable typed data object whose string representation is no longerthan the length of the data type “longest_varchar”. An ev_datum 613 canbe associated with event instances and with other abstract type objects.The ev_datum_id 900 held in ev_datum 611 is an attribute that uniquelyidentifies each stored datum. The ev_datum_id 900 is the primary key forev_datum 613. The datum 901 is a serialized string representation of adata object. Each datum 901 is representative of one abstract type andits type identifier is contained in the attribute datum_type_id 902. Theev_type-id/datum_type_id 902 uniquely identifies each abstract type.

An ev_type 612 has one or more ev_type_datum(s) 615. Thus the parententity to an ev_type_datum 615 is an ev_type 612. This makesev_type_datum 615 a child entity. An ev_type_datum 615 is stored byev_datum 613. Entity ev_type_datum 615 associates one or more datum(s)with an abstract type. This is useful when a group of events or typesshare common data. The ev_type_datum 615 contains an ev_type datum_id906, an ev_type_id (FK) 907, and an ev_datum_id (FK) 908. In oneembodiment of the invention the ev_type_datum_id 906 functions as theprimary key for ev_type_datum 615 by uniquely identifying each abstracttype/datum relation. The ev_type_id (FK) 907 uniquely identifies eachabstract type and the ev_datum_id (FK) 908 uniquely identifies eachstored datum.

An ev_datum 613 stores one or more event_datum(s) 614. An event_datum614 associates one or more datum(s) with an event instance. This isuseful when an event needs to store data not shared with other events orabstract types. For example, if the administrator of a database wants tosend a form-letter to user number 144332 at 10 PM tomorrow night tocongratulate the user for winning an on-line computer game calledfantasy baseball then the following event_datums 614 are associated withan event that sends the e-mail: userid=144332, fantasy team name,id-number of e-mail form-letter template. To represent this informationeach event_datum 614 comprises an event_datum_id 909, an event_id (FK)910, and an event_datum_id (FK) 911. The event_datum_id 909 uniquelyidentifies each event-instance/datum relation and thus serves as theprimary key for an event_datum 614. The event_id 910 uniquely identifieseach event_instance and the event_datum_id (FK) 911 uniquely identifieseach stored datum. Each event_datum 614 belongs to an event_instance611.

An event_instance 611 has one or more event_datum(s) 614. Anevent_instance 611 represents an event E of some abstract type T, orevent type. An event_instance 611 can depend upon past events, and itcan be a past event of zero or more events. An event_instance 611 canalso have an associated trigger function or a state function, or both.Neither a trigger function or a state function is necessary. Rather,both functions are optional.

The semantics of the word depend are supplied by the trigger functiondatum associated with abstract type T. An event trigger function is astored procedure which takes as input the set of events upon which Edepends and their respective states, and which returns a value of one orzero indicating whether the event E is triggered or not triggered. Anevent associated with a null trigger function datum is defined to betriggered. In one embodiment of the invention the state of an event iscomputed only if the event is triggered. The semantics of the word stateare supplied by the state function datum associated with the abstracttype, event_type_id, of E. An event state function is a stored procedurewhich computes an event_state and event_state_id based on the outcome ofthe actions it attempts to perform. An event type associated with a nullstate function datum is equivalent to an event type associated with nostate function datum. The ordered set of actions which the statefunction attempts to perform supply the semantics of the event type T.

An event_instance 611 is comprised of a primary key and two foreignkeys. The value event_id 912 is the primary key and the valuesevent_state_id (FK) 913 and ev_type_id/event_type_id 914 are foreignkeys. An event_id 912 uniquely identifies each event_instance 611. Theevent_state_id (FK) uniquely identifies each event state and theev_type_id/event_type_id 914 uniquely identifies each abstract type.

Each event_instance 611 depends upon one or more event_dependency(s)617. An event_instance 611 is also a prerequisite for eachevent_dependency 617. An event_dependency 617 represents the dependencyrelationship (DR) between an event E, called this event, and past eventsD1, D2, . . . , Dk where k is some natural number. Event E depends uponthe past events. The semantics of the word depend are supplied by thetrigger function associated with the abstract type of E. The eventdependency relationship is a mesh. That is, an event can depend uponzero to many events. An event_dependency 617 is comprised of anevent_id/this_event_id 915 and event_id/past_event_id 916. Theevent_id/this_event_id 915 and the event_id/past_event_id 916 bothuniquely identify each event_instance 611.

Each event_instance 617 is also described by an event_state 618. Anevent_state 618 is comprised of an event_state_id 917, a description918, and a ev_state_type id.ev_type_id (FK) 919. The event_state 618represents an abstract state of an event instance. The definition ofevent states is application-specific and varies according to the set ofevents being modeled. For example, is a set of events relating to creditcard authorization is modeled then a useful set of states for theseevents might include the following: “Authorization approved”,“Authorization declined”, “Hardware error—cannot retry”, “Line isbusy—retry later.” Trigger functions for the events which depend uponthis event express the application policy of when to continue processingevents dependent upon this event and when not to. The event_state_id 917in event_state 618 uniquely identifies each event state. The description918 contains a name which uniquely identifies this event state. Theevent model internal code uses description 918 to identify event states.Description 918 is also made available to external applications for thesame use. The ev_state_type_id.ev_type_id (FK) 919 value uniquelyidentifies each abstract type.

In one embodiment of the present invention a hierarchical typecontainment relationship is created. A type containment relationship isa framework for organizing data associated with the event metamodel. Theev_type_containment 616 value represents the type containmentrelationship. An ev_type_containment 616 is comprised of anev_supertype_id.ev_type_id (FK) 920, an ev_subtype_id.ev_type_id (FK)921 and a containment_type_id.ev_type_id(FK) 922. Theev_supertype_id.ev_type_id (FK) 920, the ev_subtype_id.ev_type_id (FK)921 and the containment_type_id.ev_type_id(FK) 922 are all used touniquely identify each abstract type.

The ev_type_containment 616 value represents the hierarchical typeinclusion relationship (HTIR) by associating some type (sometimes calleda subtype) with a meta- (or super-) type. A hierarchical relationship(or ordering) was chosen over the more general mesh topology to simplifysearches of the ordered set. The set of abstract object types caninclude meta-types, meta-meta-types, meta-meta-meta-types, andmeta-(k)-types where k is some natural number. If a type is called whichis not associated with a meta-type, then expressed in the notationabove, this entity represents the set of relationships betweenmeta-(k)-types and meta-(k+1)-types for all whole numbers k.

Because of the artificial restriction to hierarchical ordering, therecan be more than one meaningful way to order a given set of abstracttypes in a type containment hierarchy. For this reason a new type calleda type containment relationship is created called a containment type andassociated with the ordering relation. The containment type enables agiven set of abstract types to be ordered in any of a finite number ofhierarchies. For example, a relation HA and a relation HB can both berepresented by the containment type. All of the rows in the containmenttype corresponding to HA would have one value for containment_type_id.All of the rows corresponding to HB would have another, different value,for containment_type_id. The application locates in ev_type the type_idof the HTIR it wants to use, and then consider only those rows that havecontainment_type_ids that match the type_id.

The data in a type containment relationship is organized into ahierarchical tree structure. The tree structure enables the developer toorganize data so that the data can represent complex relationships. Thetype containment tree represents data that is related to, or a subtypeof other data. Referring now to FIG. 7 for example, a tree 700 is shown.The tree contains a series of nodes. Each node in the tree 700 is calleda type. Every type is connected to one or more other types by a branch.The branch represents the relationship one type has with another typeand is therefore called a containment type.

The tree 700 represents a number of related types 701-707. Type 701resides at the top of the tree 700. The remaining types 702-705 aresubtypes of type 701. The tree 700 has two subtypes 702 and 703branching from it. The subtypes 702 and 703 are connected by acontainment type 720. Subtype 702 has two subtypes 704 and 706 branchingfrom it these subtypes are connected to subtype 702 by anothercontainment type. The subtypes 704 and 706 are related to subtype 702.Subtype 703 has two subtypes 705 and 707 branching from it and isconnected to subtype 703 by another containment type 720. The subtypes705 and 707 are related to subtype 703. The organization of types intotree 700 enables the developer to create a framework that is capable ofrepresenting complex relationships between different types.

If type 701, for example, represents an airplane then the subtypes702-707 represent things related to an airplane. Subtypes 702 representsthe parts of an airplane, for example, and subtype 703 represent thelabor needed to maintain the airplane. The parts type, subtype 702, isfurther broken down into different kinds of parts. Subtype 704 and 706represent those parts. Subtype 704 represents bolts and subtype 706represents fabric. Bolts and fabric are both parts which an airplanecontains. The labor type, subtype 703, is further broken down into thepeople that perform labor on the airplane. Subtype 705 and 707represents those people. Subtype 705 represents Bob and subtype 707represents Sue.

The tree 700 enables provides the developer with a way to represent andorganize complex relationships between types 701-707. More than onemeaning can be given to the same data. Therefore, additional trees canbe made to represent additional relationships. For example, the peoplewho perform the labor on the airplane discussed above can also work oncars, boats, or any other object the developer defines. The bolts theairplane contains can be used in other things as well.

Computerized Embodiment

An embodiment of the invention can be implemented as computer softwarein the form of computer readable program code executed on a generalpurpose computer such as computer 200 illustrated in FIG. 2. A keyboard210 and mouse 211 are coupled to a bi-directional system bus 218. Thekeyboard and mouse are for introducing user input to the computer systemand communicating that user input to processor 213. Other suitable inputdevices may be used in addition to, or in place of, the mouse 211 andkeyboard 210. I/O (input/output) unit 219 coupled to bi-directionalsystem bus 218 represents such I/O elements as a printer, A/V(audio/video) I/O, etc.

Computer 200 includes a video memory 214, main memory 215 and massstorage 212, all coupled to bi-directional system bus 218 along withkeyboard 210, mouse 211 and processor 213. The mass storage 212 mayinclude both fixed and removable media, such as magnetic, optical ormagnetic optical storage systems or any other available mass storagetechnology. Bus 218 may contain, for example, thirty-two address linesfor addressing video memory 214 or main memory 215. The system bus 218also includes, for example, a 32-bit data bus for transferring databetween and among the components, such as processor 213, main memory215, video memory 214 and mass storage 212. Alternatively, multiplexdata/address lines may be used instead of separate data and addresslines.

In one embodiment of the invention, the processor 213 is amicroprocessor manufactured by Motorola, such as the 680X0 processor ora microprocessor manufactured by Intel, such as the 80X86, or Pentiumprocessor, or a SPARC™ microprocessor from Sun Microsystems™. However,any other suitable microprocessor or microcomputer may be utilized. Mainmemory 215 is comprised of dynamic random access memory (DRAM). Videomemory 214 is a dual-ported video random access-memory. One port of thevideo memory 214 is coupled to video amplifier 216. The video amplifier216 is used to drive the cathode ray tube (CRT) raster monitor 217.Video amplifier 216 is well known in the art and may be implemented byany suitable apparatus. This circuitry converts pixel data stored invideo memory 214 to a raster signal suitable for use by monitor 217.Monitor 217 is a type of monitor suitable for displaying graphic images.

Computer 200 may also include a communication interface 220 coupled tobus 218. Communication interface 220 provides a two-way datacommunication coupling via a network link 221 to a local network 222.For example, if communication interface 220 is an integrated servicesdigital network (ISDN) card or a modem, communication interface 220provides a data communication connection to the corresponding type oftelephone line, which comprises part of network link 221. Ifcommunication interface 220 is a local area network (LAN) card,communication interface 220 provides a data communication connection vianetwork link 221 to a compatible LAN. Wireless links are also possible.In any such implementation, communication interface 220 sends andreceives electrical, electromagnetic or optical signals which carrydigital data streams representing various types of information.

Network link 221 typically provides data communication through one ormore networks to other data devices. For example, network link 221 mayprovide a connection through local network 222 to host computer 223 orto data equipment operated by an Internet Service Provider (ISP) 224.ISP 224 in turn provides data communication services through the worldwide packet data communication network now commonly referred to as the“Internet” 225. Local network 222 and Internet 225 both use electrical,electromagnetic or optical signals which carry digital data streams. Thesignals through the various networks and the signals on network link 221and through communication interface 220, which carry the digital data toand from computer 200, are exemplary forms of carrier waves transportingthe information.

Computer 200 can send messages and receive data, including program code,through the network(s), network link 221, and communication interface220. In the Internet example, server 226 might transmit a requested codefor an application program through Internet 225, ISP 224, local network222 and communication interface 220. In accord with the invention, onesuch downloaded application is the method and apparatus for eventmodeling described herein.

The received code may be executed by processor 213 as it is received,and/or stored in mass storage 212, or other non-volatile storage forlater execution. In this manner, computer 200 may obtain applicationcode by way of a carrier wave.

Application code may be embodied in any form of computer programproduct. A computer program product comprises a medium configured tostore or transport computer readable code, or in which computer readablecode may be embedded. Some examples of computer program products areCD-ROM disks, ROM cards, floppy disks, magnetic tapes, computer harddrives, servers on a network, and carrier waves.

The computer system described above is for purposes of example only. Anembodiment of the invention may be implemented in any type of computersystem or programming or processing environment including, but notlimited to, an embedded system.

Thus, a method and apparatus for method and apparatus for event modelinghas been described.

4.3 Published API

4.3.1 ev_AddDateSingletonEvent

Create a new event instance of type DATE SINGLETON EVENT. A datesingleton event is the special ca of an interval singleton event with aninterval of 1 day.

4.3.2 ev_Add Event Datum

Create a new datum and associate it with an event instance.

4.3.3 ev_AddEventDependency

Create a dependency relationship between two event instances. “Thisevent” will depend on the “past event”. Or put another way, “past event”is prerequisite to and is generally evaluated before “this event”.

4.3.4 ev_AddEventInstanceByTypeDesc

Create a new event instance of the type specified by ©event_type_desc.

4.3.5 ev_AddIntervalSingletonEvent

Create a new interval singleton event, or ISE. An ISE is an active eventexactly one of which occurs within the given chronological interval. If©event_type_desc. is specified, an event of that type is created;otherwise a generic ISE is created. Upon return, ©new_event_id willcontinue the event_id of the ISE which already existed, or which wasnewly-created ISE if no existing ISE was found.

4.3.6 ev₁₃ AddTestEvents

Populate the schema with some test events.

4.3.7 ev_AddTypeDatum

Create a new datum and associate it with the specified type.

Type level data are used to store data elements which are shared by allinstances of a given type.

For example, a type called ‘Bob's email events’ might all use the samemail server. So disk space is conserved by storing this datum at thetype level rather than at the event_instance level. A good Java analoguewould be static class variables.

4.3.8 ev_DeleteEventInstance

Delete an event instance. Rows in table event_datum corresponding tothis event_id are cascade-deleted by a delete trigger on tableevent_instance.

4.4 Internal functions

4.4.1 ev_add_datum

Add a new datum and associate it with a table specified in part by oneof the arguments.

4.4.2 ev_add_event_instance

Add a new event instance.

4.4.3 ev_clock_tick

This is the core of the event processing subsystem. It should be runperiodically.

4.4.4. ev_event_compute_state

Compute and return the state of a single event. This procedure is meantto be called only by the procedure ev_update_update _event_states.

4.4.5 ev_get_evtypeid_by_desc

Translate a type description into a type id.

4.4.6 ev_get_state_id_by_desc

Translate a state description into a states id.

4.4.7 ev_get_type_datum

Retrieve a datum directly associated with or inherited by an abstracttype. Inheritance is computed relative to the given containment type.

4.4.8 ev_init_metamodel

Initialize the event model and metamodel data structures.

4.4.9 ev_log

Handle a log message generated by the event processor. The more positivethe message level, the more toward “noise” you get. The more negativethe message level, the more “urgent” you get. A null ©squelch_thresholdmeans no squelching.

The variables ©indentwidth and ©©nestlevel are both used to compute andindentation offset for the descriptive part of the log message. Set©indentwidth =0 to turn off indenting.

The argument ©indentleveldelta lets the caller adjust indentation by(additive) fractions of ©indentwidth.

Note that for large event meshes, performance may require the use of aless computationally intensive logging function.

4.4.10 ev_sf_date_passed

This event state function will indicate whether a specified date haspassed. It takes a single argument, which it expects to be convertableto the datetime MS SQL datatype.

4.4.12 ev_tf_all _complete

This event trigger function indicates whether all prerequisite events to©dep_event_id have happened, viz. their state type id's are that of thestate type HAPPENED.

Note that the cursor called nextprereq retrieves the set of events uponwhich ©dep_event_id is dependent.

4.4.13 ev_tf_date_passed

This event trigger function will indicate whether a specified date haspassed. It takes a single argument, which it expects to be convertableto the datetime MS SQL datatype.

4.4.14 ev_update_event_states

Compute and update the state of events matching certain criteria whichare incorporated into a view, the name of which view is passed-in as©eventset_name.

5. Example model: TheStreet free trial email

5.1 Goal

As a user's free trial subscription to TheStreet.com nears expiration,send mail to encourage the user to purchase a subscription. Send emailon the seventh, thirteenth and sixteenth days after the start of thefree trial subscription.

5.2 Event model

5.2.1 Types

We define one event type t=THE STREET FREE TRIAL EMAIL, which is asubtype of type EVENT TYPE.

5.2.2 Events

A set of three events E={e₁, e₂, e₃} is defined the elements of whichcorrespond respectively to the first, second and third emails to theuser. All three events are of type t.

5.2.3 Event datums

Three datums are defined which are associated with each element of E:ed₁ which stores the userid of the user, ed₂ which stores the date afterwhich the email should be sent, and ed₃ which stores which of the threeemail form letters to send.

5.2.4 Event states

Each event of type t will exist in one of two states: s₁=HAPPENED ands₂=YET TO HAPPEN. Upon creation an event is initialized to state s₁ andthe event transitions to state s₂ only when it succeeds in sending itsemail message.

The state function φt is defined as $\phi_{t} = {\begin{Bmatrix}s_{1} & {{if}\quad {mail}\quad {successfully}\quad {sent}} \\s_{2} & {otherwise}\end{Bmatrix}.}$

5.2.5 Dependency operator

For i i∈ {1,2,3} the dependency operator is defined as${{\Delta \quad \left( e_{i} \right)} = \begin{Bmatrix}0 & {{{if}\quad i} = 1} \\e_{i - 1} & {{{if}\quad i} > 1}\end{Bmatrix}},$

which expresses the requirement that an email event for a given userdepend on the previous email event for that user, if one exists.

The trigger function T _(t) is defined as${T_{t}(e)} = {\begin{Bmatrix}1 & {{{{if}\quad {today}} > {d_{2}\quad {and}\quad {\forall{x \in {\Delta \quad (e)}}}}},{{\phi \quad {t(x)}} = s_{1}}} \\0 & {otherwise}\end{Bmatrix}.}$

The function T _(t) expresses the requirement that the current eventwill execute, or compute its own state, only if (b 1) today's date islater than the desired email send date and (2) all events prerequisiteto this one have “HAPPENED”.

5.3 Implementation

5.3.1 Stored procedures

AddEmailByTypeDescDate Adds a “TheStreet” email event of the specifiedtype for the specified date. A bridge date singleton event precedes theemail event to reduce computation when many emails happen on a givendate. Computation is simplified because until the date singleton eventhappens, only the date singleton is checked for computability yieldingsavings which are superlinear in the number of email events scheduledper day.

AddStreetEmailEventsForUser Creates a set of events which will send asequence of emails to a “TheStreet free-trial” owner prior to theexpiration of the free trial.

SendStreetEmailToUser Implements φt for “TheStreet” email events. Thisprocedure retrieves an email form letter corresponding to ed₃, addressesit to the email address of userid ed₁ and submits the addressed letterto the commerce system's outgoing mail queue.

What is claimed is:
 1. A method for allowing a developer to enable acustomer subscription database with operations using event models, andwithout requiring changes to the underlying structure of the databasecomprising: defining an underlying structure of a database for storing aplurality of customer subscription data; storing at least one datarecord for each one of said plurality of customer subscription data;defining at least one table for storing a plurality of condition dataand plurality of action data associated with said customer subscriptiondata; defining a plurality of events, wherein each one of said pluralityof events comprises an event set of at least one of said plurality ofcondition data and at least one of said plurality of action data;associating a subscription status with each of said at least one datarecord; testing said subscription status against at least one of saidplurality of events; triggering a state transition of said subscriptionstatus by executing said at least one of said plurality of action dataassociated with said one of said plurality of events for which said atleast one of said plurality of condition data is met.
 2. The method ofclaim 1 wherein said defining an underlying structure of a databasefurther comprises defining a plurality of tables for storing userinformation.
 3. The method of claim 1 wherein said subscription datafurther comprises a subscription status.
 4. The method of claim 3wherein said subscription status further comprises a subscriptionexpiration date.
 5. The method of claim 3 wherein said subscriptionstatus further comprises at least one subscription renewal option. 6.The method of claim 1 wherein said defining a plurality of eventsfurther comprises defining at least one event metamodel.
 7. The methodof claim 1 wherein said defining a plurality of events further comprisesdefining at least one event type.
 8. The method of claim 1 wherein saiddefining a plurality of events further comprises defining at least oneevent model.
 9. The method of claim 8 wherein said defining at least oneevent model further comprises defining a hierarchical structure of saidat least one event model.
 10. The method of claim 1 wherein saiddefining at least one table for storing a plurality of condition dataand plurality of action data further comprises defining at least onetable for storing relationship references.
 11. The method of claim 10wherein said defining at least one table for storing relationshipreferences further comprises storing at least one dependencyrelationship between at least two of said plurality of events.
 12. Themethod of claim 10 wherein said storing at least one dependencyrelationship between at least two of said plurality of events furthercomprises storing at least one dependent event relationship.
 13. Themethod of claim 10 wherein said storing at least one dependencyrelationship between at least two of said plurality of events furthercomprises storing at least one prerequisite event relationship.
 14. Themethod of claim 1 wherein said testing said subscription status furthercomprises utilizing at least one stored procedure for performing saidtesting.
 15. The method of claim 1 wherein said triggering a statetransition of said subscription status further comprises adding at leastone record to said at least one table.
 16. A computer program productcomprising: a memory medium having computer readable program code forperforming credential validation embodied therein, said computerreadable program code configured to: define an underlying structure of adatabase for storing a plurality of customer subscription data; store atleast one data record for each one of said plurality of customersubscription data; define at least one table for storing a plurality ofcondition data and plurality of action data associated with saidcustomer subscription data; define a plurality of events, wherein eachone of said plurality of events comprises an event set of at least oneof said plurality of condition data and at least one of said pluralityof action data; associate a subscription status with each of said atleast one data record; test said subscription status against at leastone of said plurality of events; trigger a state transition of saidsubscription status by executing said at least one of said plurality ofaction data associated with said one of said plurality of events forwhich said at least one of said plurality of condition data is met. 17.The computer program product comprising of claim 16 wherein saidcomputer readable program code configured to define said underlyingstructure of a database further comprises computer readable program codeconfigured to define a plurality of tables for storing user information.18. The computer program product of claim 16 wherein said computerreadable program code configured to define a plurality of events furthercomprises computer readable program code configured to define at leastone event metamodel.
 19. The computer program product of claim 16wherein said computer readable program code configured to define aplurality of events further comprises computer readable program codeconfigured to define at least one event type.
 20. The computer programproduct of claim 16 wherein said computer readable program codeconfigured to define a plurality of events further comprises computerreadable program code configured to define at least one event model. 21.The computer program product of claim 20 wherein said computer readableprogram code configured to define at least one event model furthercomprises computer readable program code configured to define ahierarchical structure of said at least one event model.
 22. Thecomputer program product of claim 16 wherein said computer readableprogram code configured to define at least one table for storing aplurality of condition data and plurality of action data furthercomprises computer readable program code configured to define at leastone table for storing relationship references.
 23. The computer programproduct of claim 22 wherein said computer readable program codeconfigured to define at least one table for storing relationshipreferences further comprises computer readable program code configuredto store at least one dependency relationship between at least two ofsaid plurality of events.
 24. The computer program product of claim 22wherein said computer readable program code configured to store at leastone dependency relationship between at least two of said plurality ofevents further comprises computer readable program code configured tostore at least one dependent event relationship.
 25. The computerprogram product of claim 22 wherein said computer readable program codeconfigured to store at least one dependency relationship between atleast two of said plurality of events further comprises computerreadable program code configured to store at least one prerequisiteevent relationship.
 26. The computer program product of claim 16 whereinsaid computer readable program code configured to test said subscriptionstatus further comprises computer readable program code configured toutilize at least one stored procedure to perform said testing.
 27. Thecomputer program product of claim 16 wherein said computer readableprogram code configured to trigger a state transition of saidsubscription status further comprises computer readable program codeconfigured to add at least one record to said at least one table.